package org.jeecg.codegeneweb;

import lombok.Data;
import lombok.Getter;
import org.jeecg.codegeneweb.template.TemplateLocaltion;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

@Data
public class DestinationLocation {
    private String project_path="D:\\jeecg3";//=D:\\jeecg3；
    @Getter
    private String srcmainjava="src\\main\\java";//这个是maven构建的规范
    private String bussi_package="org\\jeecg\\modules\\demo";//=org.jeecg.modules.demo  ---程序定义的规范
    private String entitypackage;//用户输入，默认为实体类名的小写
    private String entityname;//：类名，一般大写
    private TemplateLocaltion templateLocaltion;



    public List<String> combinefilenameext(List<String> filenameList){
        String fileName="";
        List<String> filenameListresilt=new ArrayList<>();
        for(String fm:filenameList){
            //去掉temlatePath的路径
            fileName=fm.replace(templateLocaltion.getTemplatePath(),"");
            //加上desitination的路径
            fileName=project_path + File.separator + srcmainjava + File.separator + bussi_package + File.separator + entitypackage + File.separator + fileName;
            filenameListresilt.add(fileName);
        }
        return filenameListresilt;
    }
    public List<String> combinefilename(List<File> fileList){
        String fileName="";
        List<String> filenameList=new ArrayList<>();
        for(File file:fileList){
            //去掉temlatePath的路径
            fileName=file.getAbsoluteFile().toString().replace(templateLocaltion.getTemplatePath(),"");
            //加上desitination的路径
            fileName=project_path + File.separator + srcmainjava + File.separator + bussi_package + File.separator + entitypackage + File.separator + fileName;
            filenameList.add(fileName);
        }
        return filenameList;
    }
}
